<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Task10</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        html,body {
            width: 100%;
            height: 100%;
        }
        .container {
            display: flex;
            width: 100%;
            height: 60%;
            flex-wrap: nowrap;
            box-sizing: border-box;
            padding: 20px;
            justify-content: space-between;
        }
        [class *= item] {
            flex: 0 0 150px;
            border: 1px solid #f00;
        }
        .item-1 {
            height: 120px;
        }
        .item-2 {
            height: 100px;
        }
        .item-3 {
            height: 40px;
        }
        .item-4 {
            height: 200px;
            border-color: #00f;
        }
        @media (min-width: 641px) {
            .container {
                align-items: center;
            }
        }
        @media (max-width: 640px) {
            .container {
                align-items: flex-start;
                flex-wrap: wrap;
            }
            .item-4 {
                order: -1;
            }
        }
    </style>
</head>
<body>
<section class="container">
    <div class="item-1"></div>
    <div class="item-2"></div>
    <div class="item-3"></div>
    <div class="item-4"></div>
</section>
</body>
</html>